<?php

namespace app\common\model;

use app\common\basic\BaseModel;
use think\model\relation\BelongsTo;
use think\model\relation\BelongsToMany;

class CompanyUser extends BaseModel
{
    protected $table = 'vk_company_user';
    

    public function company(): BelongsTo
    {
        return $this->belongsTo(Company::class, 'company_id');
    }

    /**
     * @return BelongsToMany
     */
    public function role(): BelongsToMany
    {
        return $this->belongsToMany(CompanyRole::class, CompanyUserRole::class, 'company_role_id', 'company_user_id');
    }

}